#ifndef DCDMCOLOURSPAGE_H
#define DCDMCOLOURSPAGE_H

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "PropPage.h"
#include "RtfScriptEditor.h"
//Sulan start svn94
#include "ExListViewCtrl.h"
#include "WinUtil.h"
//End

class DCDMColoursPage : public CPropertyPage<IDD_DCDM_COLOURS>, public PropPage
{
public:

	DCDMColoursPage(SettingsManager *s) : PropPage(s) { 
		SetTitle(CTSTRING(SETTINGS_DCDM_COLOURS));
	};

	virtual ~DCDMColoursPage() { };

	BEGIN_MSG_MAP(DCDMColoursPage)
		MESSAGE_HANDLER(WM_INITDIALOG, onInitDialog)
		COMMAND_HANDLER(IDC_NORMAL_COLOUR, BN_CLICKED, onChangeColour)
		COMMAND_HANDLER(IDC_CHANGE_COLOUR_SCRIPT, BN_CLICKED, onChangeColourScript)
		COMMAND_HANDLER(IDC_CHANGE_FONT_SCRIPT, BN_CLICKED, onChangeFontScript)
		COMMAND_HANDLER(IDC_SCRIPT_BACKGROUND, BN_CLICKED, onChangeBackground)
		COMMAND_HANDLER(IDC_BROWSE_IMAGE, BN_CLICKED, onBrowseImage)
		COMMAND_HANDLER(IDC_KEYWORD_DLG, BN_CLICKED, onKeywordDialog)
		//Sulan start svn94
		NOTIFY_HANDLER(IDC_LIST, NM_CUSTOMDRAW, onCustomDraw)
		COMMAND_HANDLER(IDC_BG_COLOUR, BN_CLICKED, onChangeColour)
		//End
		REFLECT_NOTIFICATIONS()
	END_MSG_MAP()


	LRESULT onInitDialog(UINT, WPARAM, LPARAM, BOOL&);
	LRESULT onChangeColour(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
	LRESULT onChangeColourScript(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
	LRESULT onChangeFontScript(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
	LRESULT onChangeBackground(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
	LRESULT onBrowseImage(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
	LRESULT onKeywordDialog(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
	//Sulan start svn94
	LRESULT onCustomDraw(int /*idCtrl*/, LPNMHDR pnmh, BOOL& bHandled);
	//End

	CRtfScriptEditorCtrl m_PreviewScript;

	// Common PropPage interface
	PROPSHEETPAGE *getPSP() { return (PROPSHEETPAGE *)*this; }
	virtual void write();

private:
	int userListImage;
	void refreshPreviewScript();
	CListBox m_lsbListScript;
	int scriptNormal, keyword, quote, comment, library, operatorCol, scriptBkGrnd;
	LOGFONT scriptFont;

protected:

	//Sulan start svn94

	//Text colours
	int normalColour;
	int clientCheckedNotFilelistColour;
	int fileListCheckedNotClientColour;
	int fileListAndClientCheckedColour;
	int badClientColour;
	int badFilelistColour;
	int protectedColour;

	//Background colours
	int normalColour_bg;
	int clientCheckedNotFilelistColour_bg;
	int fileListCheckedNotClientColour_bg;
	int fileListAndClientCheckedColour_bg;
	int badClientColour_bg;
	int badFilelistColour_bg;
	int protectedColour_bg;

	ExListViewCtrl ctrlList;

	void insertItem(const tstring& aText, int textCol, int textBgCol){
		StringList cols;
		cols.push_back(aText);
		cols.push_back(Util::toString(textCol));
		cols.push_back(Util::toString(textBgCol));
		ctrlList.insert(cols);
		cols.clear();
	}

	void doList();
	//End

	static Item items[];
	static TextItem texts[];

};

#endif //DCDMCOLOURSPAGE_H

/**
 * @file
 * $Id: DCDMColoursPage.h 255 2005-07-16 13:06:57Z Flow84 $
 */